package org.lora.mvc;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.lora.log4j.Log4jUtil;
import org.lora.mvc.impl.MvcServiceImpl;

/**
 * <p>
 * Title:DistributeServlet
 * </p>
 * <p>
 * Desription:Servlet入口
 * </p>
 * Create Time:2016年7月6日 上午11:56:59
 * 
 * @author Bladnir@outlook.com
 *         <p>
 *         History:
 *         </p>
 *         2016年7月6日 Bladnir Create<br>
 */
public class DistributeServlet extends HttpServlet {

	private static final long serialVersionUID = 1L;

	private static Logger logger = Log4jUtil.getSystemLogger();

	private static final IMvcService service = new MvcServiceImpl();

	/**
	 * 构造方法
	 */
	public DistributeServlet() {
		super();
	}

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	@Override
	public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		try {
			doPost(request, response);
		} catch (Exception e) {
			logger.error("", e);
		}
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	@Override
	public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		try {
			service.excuteRequest(request, response);
		} catch (Exception e) {
			logger.error("", e);
		}
	}

}
